put 0 into xstrt -- CHANGE 0 TO STARTING VALUE OF VARIABLE X
put 7 into xend -- CHANGE 7 TO ENDING VALUE OF VARIABLE X
put .2 into incr -- CHANGE .2 TO INCREMENT OF X VALUE
-- CHANGE THE FOLLOWING TO ">=" IF INCR < 0 AND XSTRT > XEND
repeat while xstrt <= xend
-- REPLACE NEXT LINE WITH YOUR FORMULA (WITH SAME FORMAT)
put sin(xstrt) into y
-- END OF (PUT) FORMULA (INTO Y)
put y & "," after last item of field "Data"
put xstrt + incr into xstrt
end repeat
delete last char of field "Data"
click at location of background button "Line"
end mouseUp
-- part 12 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=444 top=197 right=220 bottom=503
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Formula
----- HyperTalk script -----
on mouseUp
set userLevel to 5
edit script of button "RunF"
domenu "compact stack"
set userLevel to 3
end mouseUp
-- part contents for card part 7
----- text -----
26,0.5764
-- part contents for card part 8
----- text -----
Calc Plot
by C. Kingston
This is a modified version of the plot stack supplied with HyperCard. It is designed to accompany the "RPN Calculator" stack. Or it can be used alone to plot a simple function.
When you make a list with the [Lst] key in the RPN calculator program, you may make a line plot of the values in the list by clicking on the plot icon. That button transfers to this stack, copies the list into the data field, and draws a line graph of the values.
The graph is scaled to the data. If any values extend below zero, a line will be drawn across the graph at the value 0.
You may check the location of any point in the graph by holding down the Option key and clicking at the point. This will display the position in the list of the value plotted in that area, and the abscissa value of the point. Thus a location display of "1,20" would mean that item 1 of the list is plotted in that area, and the "y" value at the hot spot of the pointer is 20.
Clicking on the [Line] button will redo the plot, or will plot new values entered into the data field at the bottom.
The buttons [Formula] and [RunF] allow you to plot a function that can be done entirely with the HyperTalk built in functions.
Click on [Formula] to edit the formula which is contained in the script of button [RunF]. After clicking "OK", click [RunF] to run the function, store the values in the Data field, and draw the plot. If the function can be done within HyperTalk, this is a lot faster than using the calculator.
Eventually more capabilities will be built into this stack, such as axes, X-Y plotting, scatter plots, and so on